﻿using AopTest.test;
using autofac.test.aop;
using autofac.test.Controllers;
using Autofac;
using Autofac.Extras.DynamicProxy;
using Core.BLL.Service;
using Core.InterFace.Interface;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;

namespace autofac.test.Extend
{
    public class DefaultModule : Autofac.Module
    {

        protected override void Load(ContainerBuilder builder)
        {
            
            //注册aop
            builder.Register(c => new autofacAop());

            //注入测试服务
            builder.Register(c => new AOPTest());

           
            builder.RegisterType<A>().As<IA>().EnableInterfaceInterceptors(); //开启aop


            builder.RegisterType<ValuesController>().PropertiesAutowired(); //控制器开启属性注入
            builder.RegisterType<MessageService>().As<IMessageService>().PropertiesAutowired().EnableInterfaceInterceptors();
        }

    }
}
